﻿<Application
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="ServEvo.App"
             StartupUri="Layout/GUI/MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"/>
                <!--<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml"/>-->


                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Styles.xaml" />
                <!--<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />-->
                <ResourceDictionary Source="/Resources/Icons.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <!--Background-->
            <SolidColorBrush x:Key="Background" Color="#1C1C1C"/>
            <SolidColorBrush x:Key="LightBackground" Color="#2D2D30"/>
            <Color x:Key="AccentColor">#2D2D30</Color>
            <Color x:Key="WhiteColor">#2D2D30</Color>
            <Color x:Key="BlackColor">#FFFFFFFF</Color>

            <!--Foreground-->
            <SolidColorBrush x:Key="Foreground" Color="#FFFFFF"/>

            <!--General-->
            <SolidColorBrush x:Key="BackgroundHighlighted" Color="#54545C"/>
            <SolidColorBrush x:Key="BorderBrushHighlighted" Color="#6A6A75"/>
            <SolidColorBrush x:Key="BackgroundSelected" Color="#007ACC"/>
            <SolidColorBrush x:Key="BorderBrushSelected" Color="#1C97EA"/>
            <SolidColorBrush x:Key="BackgroundNormal" Color="#3F3F46"/>
            <SolidColorBrush x:Key="BorderBrushNormal" Color="#54545C"/>
            <Style x:Key="TabItemStyle1" TargetType="{x:Type TabItem}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Grid Background="{TemplateBinding Background}" Height="23" SnapsToDevicePixels="True">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Center" Margin="10,0" VerticalAlignment="Center">
                                    <ContentPresenter.Resources>
                                        <Style x:Key="{x:Type TextBlock}" TargetType="{x:Type TextBlock}">
                                            <Setter Property="Foreground" Value="White"/>
                                        </Style>
                                    </ContentPresenter.Resources>
                                </ContentPresenter>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="False">
                                    <Setter Property="Background" Value="Transparent"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="#FF1C97EA"/>
                                </Trigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="Background" Value="#FF007ACC"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="TabItemStyle2" TargetType="{x:Type TabItem}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Grid Background="{TemplateBinding Background}" Height="23" SnapsToDevicePixels="True">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Center" Margin="10,0" VerticalAlignment="Center">
                                    <ContentPresenter.Resources>
                                        <Style x:Key="{x:Type TextBlock}" TargetType="{x:Type TextBlock}">
                                            <Setter Property="Foreground" Value="White"/>
                                        </Style>
                                    </ContentPresenter.Resources>
                                </ContentPresenter>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="False">
                                    <Setter Property="Background" Value="Transparent"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="Transparent"/>
                                </Trigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="Background" Value="Transparent"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}">
                <Setter Property="Background" Value="#3F3F46"/>
                <Setter Property="BorderBrush" Value="#54545C"/>
            </Style>
            
            <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="20"/>
                    </Grid.ColumnDefinitions>
                    <Border SnapsToDevicePixels="True" x:Name="Border" Grid.ColumnSpan="2" Background="{StaticResource BackgroundNormal}" BorderBrush="{StaticResource BorderBrushNormal}" BorderThickness="1" />
                    <Path x:Name="Arrow" Grid.Column="1" Opacity="0.6" Fill="{StaticResource Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="ToggleButton.IsMouseOver" Value="true">
                        <Setter TargetName="Arrow" Property="Opacity" Value="1" />
                        <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource BorderBrushHighlighted}"/>
                    </Trigger>
                    <Trigger Property="ToggleButton.IsChecked" Value="true">
                        <Setter TargetName="Arrow" Property="Opacity" Value="1" />
                        <Setter TargetName="Arrow" Property="Fill" Value="{StaticResource BackgroundSelected}" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

            <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
                <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
            </ControlTemplate>

            <Style x:Key="StandardComboBox" TargetType="ComboBox">
                <Setter Property="Foreground" Value="{StaticResource Foreground}"/>
                <Setter Property="SnapsToDevicePixels" Value="true"/>
                <Setter Property="OverridesDefaultStyle" Value="true"/>
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
                <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
                <Setter Property="MinWidth" Value="120"/>
                <Setter Property="MinHeight" Value="20"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ComboBox">
                            <Grid>
                                <ToggleButton Name="ToggleButton" 
                                      Template="{StaticResource ComboBoxToggleButton}" 
                                      Grid.Column="2" 
                                      Focusable="false" 
                                      IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                      ClickMode="Press"/>
                                <ContentPresenter Name="ContentSite" 
                                          IsHitTestVisible="False"  
                                          Content="{TemplateBinding SelectionBoxItem}" 
                                          ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" 
                                          ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" 
                                          Margin="3,3,23,3" 
                                          VerticalAlignment="Center" 
                                          HorizontalAlignment="Left"/>
                                <TextBox x:Name="PART_EditableTextBox" 
                                 CaretBrush="{StaticResource Foreground}"
                                 Style="{x:Null}" 
                                 Template="{StaticResource ComboBoxTextBox}" 
                                 HorizontalAlignment="Left" 
                                 VerticalAlignment="Center" 
                                 Margin="3,3,23,3" 
                                 Focusable="True" 
                                 Background="Transparent" 
                                 Foreground="{StaticResource Foreground}" 
                                 Visibility="Hidden" 
                                 IsReadOnly="{TemplateBinding IsReadOnly}"/>
                                <Popup VerticalOffset="-1" SnapsToDevicePixels="True" Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True"  Focusable="False" PopupAnimation="Slide">
                                    <Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                        <Border x:Name="DropDownBorder" Background="{StaticResource BackgroundNormal}" BorderThickness="1" BorderBrush="{StaticResource BorderBrushNormal}"/>
                                        <ScrollViewer SnapsToDevicePixels="True">
                                            <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                        </ScrollViewer>
                                    </Grid>
                                </Popup>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="HasItems" Value="false">
                                    <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                                </Trigger>
                                <Trigger Property="IsGrouping" Value="true">
                                    <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                                </Trigger>
                                <Trigger Property="IsEditable" Value="true">
                                    <Setter Property="IsTabStop" Value="false"/>
                                    <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
                                    <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Resources>
                    <Style TargetType="ComboBoxItem">
                        <Setter Property="SnapsToDevicePixels" Value="true"/>
                        <Setter Property="OverridesDefaultStyle" Value="true"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ComboBoxItem">
                                    <Border Name="Border" Padding="2" SnapsToDevicePixels="true" BorderThickness="1">
                                        <ContentPresenter />
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsHighlighted" Value="true">
                                            <Setter TargetName="Border" Property="Background" Value="{StaticResource BackgroundHighlighted}"/>
                                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource BorderBrushHighlighted}"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Style.Resources>
            </Style>
            <Style x:Key="ButtonFocusVisual">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
                <GradientStop Color="#F3F3F3" Offset="0"/>
                <GradientStop Color="#EBEBEB" Offset="0.5"/>
                <GradientStop Color="#DDDDDD" Offset="0.5"/>
                <GradientStop Color="#CDCDCD" Offset="1"/>
            </LinearGradientBrush>
            <SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>

            <Style x:Key="ButtonStyleDefault" TargetType="{x:Type Button}">
                <Setter Property="Visibility" Value="Visible"/>
                <Setter Property="Foreground" Value="{StaticResource Foreground}"/>
                <Setter Property="Background" Value="{StaticResource BackgroundNormal}"/>
                <Setter Property="BorderBrush" Value="{StaticResource BorderBrushNormal}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Border SnapsToDevicePixels="True"
				            BorderThickness="1"
				            BorderBrush="{TemplateBinding BorderBrush}" 
				            Background="{TemplateBinding Background}">
                                <Grid>
                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="BorderBrush" Value="{StaticResource BorderBrushHighlighted}" />
                                    <Setter Property="Background" Value="{StaticResource BackgroundHighlighted}" />
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Background" Value="{StaticResource BackgroundSelected}"/>
                                    <Setter Property="BorderBrush" Value="{StaticResource BorderBrushSelected}"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Background" Value="Transparent" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>


            <Style x:Key="ButtonStyleDownload" TargetType="{x:Type Button}">
                <Setter Property="Visibility" Value="Visible"/>
                <Setter Property="Foreground" Value="#FFFFFF"/>
                <Setter Property="Background" Value="#007ACC"/>
                <Setter Property="BorderBrush" Value="#1C97EA"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Border SnapsToDevicePixels="True"
				            BorderThickness="1"
				            BorderBrush="{TemplateBinding BorderBrush}" 
				            Background="{TemplateBinding Background}">
                                <Grid>
                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="#FF0089E6" />
                                    <Setter Property="BorderBrush" Value="#FF0098FF" />
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Background" Value="#007ACC"/>
                                    <Setter Property="BorderBrush" Value="#1C97EA"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Background" Value="Transparent" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>
